﻿using System;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Adapters;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Factories;
using GC_FFW.SoccerfameParser.Abstractions.Managers;
using GC_FFW.SoccerfameParser.Adapters;

namespace GC_FFW.SoccerfameParser.Factories
{
	public class AdapterFactory : IAdapterFactory
	{
		#region Variables

		private readonly HtmlDocumentBaseManager _htmlDocumentManager;
		private readonly ISoccerfameDataHelperFactory _soccerfameDataHelperFactory;

		#endregion

		#region Constructors

		public AdapterFactory(HtmlDocumentBaseManager htmlDocumentManager, ISoccerfameDataHelperFactory soccerfameDataHelperFactory)
		{
			if (htmlDocumentManager == null)
				throw new ArgumentNullException(string.Format("Html Document Manager"));
			_htmlDocumentManager = htmlDocumentManager;
			_soccerfameDataHelperFactory = soccerfameDataHelperFactory;
		}

		#endregion

		#region IAdapterFactory Members

		public IFutureMatchAdapter CreateFutureMatchAdapter()
		{
			return new FutureMatchAdapter(_htmlDocumentManager, _soccerfameDataHelperFactory);
		}

		public IMatchAdapter CreateMatchAdapter()
		{
			return new MatchAdapter(_htmlDocumentManager, _soccerfameDataHelperFactory);
		}

		#endregion
	}
}
